import qs from "qs"
import http from '../utils/axios';  //引进http
import React from 'react';

export const baseUrl = 'http://dsq.ljc.icu:8080'

// 1、轮播管理

// 查询和 首次渲染
export const displayCarouselInfo = (data:any)=>{
    return http.post<any>(baseUrl+'/shopping-mall/carousel/display',data)
}

// 删除轮播图
export const delBanner = (data:any)=>{
    return http.get<any>(baseUrl+'/shopping-mall/carousel/delone',data)
}

// 批量删除
export const batchDelBanner = (data:React.Key[])=>{
    return http.post<any>(baseUrl+'/shopping-mall/carousel/batchDel',data)
}

// 上传轮播图片
export const uploadBanner = (data:any)=>{
    return http.post<any>(baseUrl+'/shopping-mall/carousel/upload',data,{headers:{'Content-Type':'multipart/form-data'}})
}

// 修改轮播信息
export const modBanner = (data:any)=>{
    return http.post<any>(baseUrl+'/shopping-mall/carousel/update',data)
}

// 新增轮播信息
export const addBanner = (data:any)=>{
    return http.post<any>(baseUrl+'/shopping-mall/carousel/add',data)
}


// 2、专区管理

// 渲染数据
export const showInfo = (data:any)=>{
    return http.post<any>(baseUrl+'/shopping-mall/tsa/show',data)
}

// 单个删除专区
export const delZone = (data:{})=>{
    return http.get<any>(baseUrl+'/shopping-mall/tsa/del',data)
}

// 批量删除
export const batchDelZone=(data:React.Key[])=>{
    return http.post<any>(baseUrl+'/shopping-mall/tsa/batchDel',data)
}

// 修改专区信息
export const modZone = (data:any)=>{
    return http.post<any>(baseUrl+'/shopping-mall/tsa/update',data)
}

// 新增专区信息
export const addZone = (data:any)=>{
    return http.post<any>(baseUrl+'/shopping-mall/tsa/add',data)
}

// 2-1 商品管理
//渲染数据
export const showZoneShop=(data:any)=>{
    return http.post<any>(baseUrl+'/shopping-mall/tsa/getTsaGoods',data)
}

// 修改位置
export const modPosition=(data:any)=>{
    return http.post<any>(baseUrl+'/shopping-mall/tsa/updateLocation',data)
}

// 移除专区中商品
export const delShop = (data:any)=>{
    return http.post<any>(baseUrl+'/shopping-mall/tsa/delGoods',data)
}


// 2-2 添加商品

// 渲染添加商品的筛选分类
export const getClassify = ()=>{
    return http.get<any>(baseUrl+'/shopping-mall/tsa/getLevel')
}
// 渲染添加商品的品牌
export const getBrand = ()=>{
    return http.get<any>(baseUrl+'/shopping-mall/tsa/selectBrand')
}

// 渲染添加商品的标签
export const getLabel = ()=>{
    return http.get<any>(baseUrl+'/shopping-mall/label/getAll')
}

// 查询可添加的商品
export const selectGoods = (data:any)=>{
    return http.post<any>(baseUrl+'/shopping-mall/tsa/selectGoods',data)
}

// 向专区添加商品
export const addZoneShop = (data:{})=>{
    return http.get<any>(baseUrl+'/shopping-mall/tsa/insertGoods',data)
}


// 3、搜索管理

// 渲染数据
export const showSearch = (data:any)=>{
    return http.post<any>(baseUrl+'/shopping-mall/search/show',data)
}

// 删除数据
export const delSearch = (data:{})=>{
    return http.get<any>(baseUrl+'/shopping-mall/search/del',data)
}

// 修改关键字
export const modSearch = (data:any)=>{
    return http.post<any>(baseUrl+'/shopping-mall/search/update',data)
}

// 新增关键字
export const addSearch = (data:any)=>{
    return http.post<any>(baseUrl+'/shopping-mall/search/add',data)
}

// 4、标签管理

// 渲染数据
export const showTag = (data:any)=>{
    return http.post<any>(baseUrl+'/shopping-mall/label/showLabel',data)
}

// 删除数据
export const delTag = (data:{})=>{
    return http.get<any>(baseUrl+'/shopping-mall/label/delLabel',data)
}

// 修改标签
export const modTag= (data:any)=>{
    return http.post<any>(baseUrl+'/shopping-mall/label/updateLabel',data)
}

// 新增标签
export const addTag= (data:any)=>{
    return http.post<any>(baseUrl+'/shopping-mall/label/addLabel',data)
}


// 5、运费管理

//渲染数据
export const showFreight = (data:any)=>{
    return http.post<any>(baseUrl+'/shopping-mall/freight/show',data)
}

// 查询地区金额
export const showMoney = ()=>{
    return http.get<any>(baseUrl+'/shopping-mall/freeShopping/select')
}

// 设置地区金额
export const setMoney= (data:any)=>{
    return http.get<any>(baseUrl+'/shopping-mall/freeShopping/update',data)
}

// 删除数据
export const delFreight= (data:{})=>{
    return http.get<any>(baseUrl+'/shopping-mall/freight/del',data)
}

// 修改地区运费
export const modFreight= (data:any)=>{
    return http.post<any>(baseUrl+'/shopping-mall/freight/update',data)
}

// 新增地区运费
export const addFreight= (data:any)=>{
    return http.post<any>(baseUrl+'/shopping-mall/freight/add',data)
}

// 添加商品
// 获取所有标签
export const showAllTag= ()=>{
    return http.get<any>(baseUrl+'/shopping-mall/label/getAll')
}
